Use eventsource for secondary resource by default#2968
Use eventsource for secondary resource by default#2968florianknecht wants to merge 1 commit intooperator-framework:mainfrom
Conversation
2c662f0 to
c885980
Compare
c885980 to
cc462c2
Compare
|
This is a bot problematic, since the target event source could still hold multiple resources for this type. |
|
Note that the current design check on |
|
Got it - digging a little deeper with your hint made me understand how it's supposed to work. Thanks a lot! |
The current design is wrong because it will never properly match resources that need to be updated even if |
|
My issues here were caused by my Kotlin runtime not enforcing checked exceptions, see #2965 @metacosm you're right, while a secondary resource is not reconciled it will not be returned by this method. Might be intentional though - I've not yet gotten deep enough into this. On the plus side, Kotlin DataClasses already implement a clean equals/hashcode for my external secondary resource type so I got that covered at least. |
|
@florianknecht |
|
@florianknecht |
|
But the current approach is also functional, I don't see it broken. The API might be more elegant, though. |
Have you tested with a scenario where the dependent resource needs to be updated (i.e. the current state doesn't match the desired state)? |


AbstractEventSourceHolderDependentResource may have the current state of the dependent resource in its event sources cache. Let's use that by default.
Otherwise the super implementation in AbstractDependentResource runs empty via context.getSecondaryResources, never looking for information in the event source's cache. Which forces all inheritors to implement this lookup themselves (e.g. PerResourcePollingExternalDependentResource, where I noticed this).